package com.camp.android.trip.n.track.trip;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.camp.android.trip.n.track.DatabaseManager;
import com.camp.android.trip.n.track.ItemActivity;
import com.camp.android.trip.n.track.R;
import com.camp.android.trip.n.track.Trip;


public class TripDetailsFragment extends Fragment {

	  

	    public TripDetailsFragment() {
	    }

	    @Override
	    public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        Log.i("Tag","Created upcoming fragment");
	    }

	    @Override
	    public View onCreateView(LayoutInflater inflater, ViewGroup container,
	            Bundle savedInstanceState) {
	        View rootView = inflater.inflate(R.layout.fragment_trip_details, container, false);
	        Log.i("tag","upcoming fragment view created");
	        TextView dates_text = (TextView) rootView.findViewById(R.id.text_dates);
	        DatabaseManager dbm = new DatabaseManager(getActivity());
	        Trip trip = dbm.getTripById(((TripItineraryActivity) (getActivity())).trip_id);
	        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
	        String startStr = dateFormat.format(trip.start.getTime());
	        String endStr = dateFormat.format(trip.end.getTime());
	        dates_text.setText(startStr + " to " + endStr); 
	        TextView text_city = (TextView) rootView.findViewById(R.id.text_city);
	        text_city.setText(trip.city);
	        return rootView; 
	    }
	    
	    
}

/*



*/